package com.lmy.springCloud.controller;

import com.lmy.springCloud.service.StorageService;
import com.lmy.springCloud.utils.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class StorageController {

    @Resource
    private StorageService storageService;

    @PostMapping(value = "/storage/reduce")
    public Result reduce(@RequestParam(value = "productId") Long productId, @RequestParam(value = "nums")Integer nums) {
        storageService.reduce(productId, nums);
        return Result.success(null, "扣减库存成功");
    }
}
